//_________________________________________________________________________________________
//_________________________________________________________________________________________
//
// NAME:          FFT.
// PURPOSE:       Быстрое преобразование Фурье: Комплексный сигнал в комплексный спектр и обратно.
//                В случае действительного сигнала в мнимую часть (Idat) записываются нули.
//                Количество отсчетов - кратно 2**К - т.е. 2, 4, 8, 16, ... (см. комментарии ниже).
//                (C) Sergey Aleynik.  saleynik@yandex.ru
//              
// PARAMETERS:  
//
//    float *Rdat    [in, out] - Real part of Input and Output Data (Signal or Spectrum)
//    float *Idat    [in, out] - Imaginary part of Input and Output Data (Signal or Spectrum)
//    int    N       [in]      - Input and Output Data lendth (Number of samples in arrays)
//    int    LogN    [in]      - Logarithm2(N)
//    int    Ft_Flag [in]      - Ft_Flag = FT_ERR_DIRECT  (i.e. -1) - Direct  FFT  (Signal to Spectrum)
//                             Ft_Flag = FT_ERR_INVERSE (i.e.  1) - Inverse FFT  (Spectrum to Signal)
//
// RETURN VALUE:  false on parameter error, true on success.
//_________________________________________________________________________________________
//
// NOTE: In this algorithm N and LogN can be only:
//       N    = 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384;
//       LogN = 2, 3,  4,  5,  6,   7,   8,   9,   10,   11,   12,   13,    14;
//_________________________________________________________________________________________
//_________________________________________________________________________________________
 
 
#define  NUMBER_IS_2_POW_K(x)   ((!((x)&((x)-1)))&&((x)>1))  // x is pow(2, k), k=1,2, ...
#define  FT_DIRECT        -1    // Direct transform.
#define  FT_INVERSE        1    // Inverse transform.
 

#include <stddef.h>
#include <stdio.h>
typedef int qint16;

bool  FFT(qint16 *Rdat, qint16 *Idat, qint16 N, qint16 LogN, qint16 Ft_Flag)
{
  // parameters error check:
  if((Rdat == NULL) || (Idat == NULL))                  return false;
  if((N > 16384) || (N < 1))                            return false;
  if(!NUMBER_IS_2_POW_K(N))                             return false;
  if((LogN < 2) || (LogN > 14))                         return false;
  if((Ft_Flag != FT_DIRECT) && (Ft_Flag != FT_INVERSE)) return false;
 
  register qint16  i, j, n, k, io, ie, in, nn;
  qint16         ru, iu, rtp, itp, rtq, itq, rw, iw, sr;
 
  static const qint16 Rcoef[14] =
  {  -127, 0, 91, 118, 126, 
    125, 124, 123, 122, 121, 
    120, 119, 118, 117 
  };
  static const qint16 Icoef[14] =
  {   0, -127, -91, -49, -25, 
      -14, -7, -4, -3, -2, 
      -13, -6, -3, -2 
  };
 
  nn = N >> 1;
  ie = N;
  for(n=1; n<=LogN; n++)
  {
    rw = Rcoef[LogN - n];
    iw = Icoef[LogN - n];
    if(Ft_Flag == FT_INVERSE) iw = -iw;
    in = ie >> 1;
    ru = 1;
    iu = 0;
    for(j=0; j<in; j++)
    {
      for(i=j; i<N; i+=ie)
      {
        io       = i + in;
        rtp      = Rdat[i]  + Rdat[io];
        itp      = Idat[i]  + Idat[io];
        rtq      = Rdat[i]  - Rdat[io];
        itq      = Idat[i]  - Idat[io];
        Rdat[io] = rtq * ru - itq * iu;
        Idat[io] = itq * ru + rtq * iu;
        Rdat[i]  = rtp;
        Idat[i]  = itp;
      }
 
      sr = ru;
      ru = ru * rw - iu * iw;
      iu = iu * rw + sr * iw;
    }
 
    ie >>= 1;
  }
 
  for(j=i=1; i<N; i++)
  {
    if(i < j)
    {
      io       = i - 1;
      in       = j - 1;
      rtp      = Rdat[in];
      itp      = Idat[in];
      Rdat[in] = Rdat[io];
      Idat[in] = Idat[io];
      Rdat[io] = rtp;
      Idat[io] = itp;
    }
 
    k = nn;
 
    while(k < j)
    {
      j   = j - k;
      k >>= 1;
    }
 
    j = j + k;
  }
 
  if(Ft_Flag == FT_INVERSE) return true;
 
   
  for(i=0; i<N; i++)
  {
    Rdat[i] /=  N;
    Idat[i] /=  N;
  }
 
  return true;
}



void FFT_probe(){
  
  qint16 RealData[2048] = {
      104, 116, 16, 117, 81, 12, 36, 70, 123, 124, 20, 124, 123, 62, 102, 18, 
      54, 117, 101, 123, 84, 5, 109, 120, 87, 97, 95, 50, 84, 22, 90, 4, 
      35, 6, 12, 105, 89, 41, 122, 4, 56, 49, 98, 102, 24, 63, 57, 83, 
      91, 97, 35, 87, 84, 21, 15, 64, 123, 44, 75, 29, 96, 33, 65, 89, 
      114, 123, 70, 18, 19, 33, 108, 33, 104, 31, 119, 45, 25, 32, 79, 61, 
      45, 106, 75, 70, 117, 37, 97, 96, 49, 73, 10, 7, 68, 100, 120, 17, 
      73, 60, 2, 43, 21, 102, 40, 68, 21, 77, 34, 84, 88, 96, 58, 11, 
      29, 117, 20, 106, 69, 128, 10, 57, 14, 123, 1, 99, 105, 111, 11, 51, 
      33, 102, 55, 117, 23, 34, 19, 17, 111, 74, 70, 19, 109, 80, 45, 66, 
      51, 10, 31, 16, 24, 31, 53, 6, 116, 121, 63, 63, 43, 115, 47, 14, 
      100, 50, 31, 52, 12, 17, 121, 122, 74, 8, 30, 45, 105, 2, 6, 22, 
      83, 94, 83, 58, 70, 38, 95, 24, 88, 23, 47, 80, 100, 10, 119, 99, 
      62, 56, 57, 39, 65, 65, 105, 102, 82, 48, 104, 68, 45, 120, 112, 70, 
      80, 75, 27, 39, 60, 30, 108, 25, 29, 22, 29, 56, 40, 118, 55, 24, 
      116, 125, 56, 14, 33, 52, 76, 34, 77, 91, 28, 15, 38, 41, 54, 65, 
      11, 34, 103, 4, 119, 93, 63, 74, 30, 59, 123, 70, 67, 30, 63, 80, 
      87, 51, 47, 126, 5, 113, 117, 102, 13, 34, 43, 87, 17, 92, 14, 84, 
      63, 100, 92, 116, 114, 43, 89, 25, 4, 95, 64, 61, 116, 78, 79, 110, 
      103, 74, 23, 31, 113, 4, 63, 21, 125, 91, 64, 60, 8, 87, 5, 9, 
      67, 12, 105, 105, 92, 19, 84, 66, 125, 83, 102, 58, 55, 106, 11, 17, 
      22, 50, 106, 103, 8, 51, 67, 53, 84, 80, 37, 55, 2, 126, 21, 14, 
      48, 25, 63, 43, 122, 118, 7, 94, 34, 54, 70, 121, 53, 126, 39, 90, 
      85, 69, 89, 85, 23, 16, 128, 22, 4, 72, 113, 86, 24, 47, 59, 126, 
      20, 110, 83, 48, 24, 55, 62, 15, 75, 29, 49, 75, 32, 37, 79, 34, 
      106, 126, 93, 44, 75, 14, 116, 113, 105, 33, 76, 3, 54, 40, 21, 23, 
      54, 12, 77, 60, 89, 90, 82, 4, 9, 41, 68, 84, 52, 105, 92, 124, 
      68, 42, 14, 78, 100, 54, 12, 34, 20, 36, 56, 67, 59, 112, 66, 121, 
      82, 123, 31, 87, 37, 86, 89, 9, 33, 29, 85, 108, 44, 100, 86, 1, 
      77, 50, 117, 0, 59, 54, 59, 99, 41, 100, 60, 5, 23, 92, 61, 20, 
      44, 78, 25, 95, 31, 117, 34, 98, 24, 37, 12, 74, 87, 70, 54, 82, 
      83, 87, 81, 121, 27, 91, 30, 15, 78, 58, 59, 85, 99, 45, 85, 53, 
      108, 107, 33, 79, 75, 69, 111, 34, 41, 15, 120, 83, 61, 82, 70, 83, 
      70, 92, 67, 127, 28, 14, 14, 8, 52, 57, 47, 98, 80, 99, 119, 125, 
      25, 18, 89, 12, 67, 68, 110, 62, 50, 86, 95, 67, 45, 19, 75, 34, 
      6, 97, 31, 57, 88, 46, 94, 51, 87, 90, 57, 3, 42, 54, 35, 25, 
      105, 55, 114, 50, 98, 51, 103, 97, 48, 28, 101, 122, 42, 86, 56, 107, 
      98, 21, 110, 127, 66, 113, 75, 20, 26, 52, 96, 106, 101, 41, 68, 12, 
      14, 17, 87, 63, 24, 63, 19, 7, 109, 72, 119, 89, 75, 104, 113, 127, 
      0, 111, 78, 127, 68, 61, 103, 29, 64, 115, 74, 108, 95, 75, 32, 85, 
      11, 80, 85, 93, 114, 126, 98, 74, 119, 74, 2, 15, 110, 62, 108, 27, 
      71, 81, 4, 79, 46, 6, 63, 25, 16, 26, 19, 24, 5, 81, 36, 69, 
      89, 64, 69, 57, 16, 63, 109, 112, 35, 27, 72, 82, 53, 26, 121, 11, 
      14, 18, 21, 79, 73, 7, 119, 93, 94, 8, 110, 120, 126, 110, 101, 66, 
      23, 51, 17, 4, 120, 39, 38, 43, 60, 83, 3, 108, 72, 109, 45, 57, 
      7, 23, 85, 42, 115, 15, 127, 69, 90, 128, 37, 53, 59, 98, 105, 13, 
      23, 46, 7, 67, 43, 22, 27, 116, 86, 60, 117, 13, 95, 94, 72, 24, 
      76, 38, 17, 27, 115, 9, 31, 7, 57, 2, 115, 25, 12, 39, 58, 13, 
      127, 43, 38, 8, 38, 6, 65, 97, 81, 12, 10, 99, 116, 68, 14, 106, 
      43, 38, 96, 1, 6, 85, 77, 67, 93, 91, 100, 37, 89, 71, 51, 8, 
      100, 43, 78, 95, 13, 16, 70, 62, 114, 102, 94, 7, 9, 11, 102, 121, 
      88, 17, 93, 14, 15, 82, 42, 84, 96, 75, 95, 30, 94, 124, 111, 11, 
      47, 47, 88, 77, 101, 47, 26, 11, 99, 26, 50, 71, 29, 82, 62, 19, 
      100, 13, 38, 30, 68, 12, 52, 13, 14, 100, 37, 77, 123, 55, 89, 97, 
      55, 84, 14, 120, 24, 34, 102, 62, 98, 51, 35, 5, 86, 55, 58, 78, 
      8, 40, 99, 89, 16, 17, 12, 1, 54, 84, 93, 68, 14, 81, 16, 17, 
      13, 18, 22, 25, 41, 41, 28, 32, 114, 90, 71, 24, 27, 10, 117, 90, 
      71, 40, 21, 80, 126, 22, 33, 51, 9, 88, 52, 126, 51, 79, 20, 49, 
      21, 97, 112, 45, 88, 38, 68, 107, 76, 43, 38, 58, 54, 46, 71, 95, 
      54, 55, 16, 3, 37, 41, 84, 122, 120, 59, 31, 98, 97, 95, 95, 14, 
      87, 59, 27, 13, 105, 22, 21, 85, 114, 66, 90, 20, 122, 69, 87, 5, 
      104, 96, 15, 67, 42, 70, 51, 53, 23, 33, 3, 118, 84, 119, 21, 118, 
      102, 74, 56, 33, 96, 29, 8, 98, 86, 92, 82, 54, 50, 104, 41, 104, 
      101, 109, 65, 81, 122, 57, 8, 111, 81, 45, 128, 29, 84, 77, 50, 18, 
      3, 54, 24, 93, 47, 108, 94, 73, 23, 123, 34, 118, 29, 48, 11, 82, 
      23, 6, 93, 44, 85, 49, 80, 3, 117, 102, 95, 104, 49, 79, 74, 68, 
      35, 32, 58, 29, 103, 126, 4, 69, 11, 103, 127, 9, 120, 2, 88, 100, 
      68, 113, 115, 80, 18, 28, 23, 5, 14, 79, 120, 45, 53, 126, 121, 87, 
      127, 98, 43, 85, 31, 38, 87, 68, 53, 77, 96, 75, 71, 75, 66, 11, 
      92, 128, 45, 124, 44, 113, 58, 53, 28, 16, 40, 93, 100, 89, 1, 108, 
      118, 99, 5, 48, 90, 93, 29, 34, 86, 61, 80, 30, 23, 106, 98, 120, 
      14, 23, 13, 63, 25, 115, 13, 6, 71, 99, 40, 23, 43, 27, 65, 116, 
      81, 13, 50, 7, 64, 55, 128, 104, 62, 114, 18, 50, 119, 117, 91, 79, 
      44, 120, 16, 94, 83, 107, 51, 96, 107, 41, 71, 125, 70, 42, 79, 46, 
      97, 53, 63, 89, 125, 42, 107, 95, 122, 4, 46, 85, 36, 29, 91, 80, 
      76, 85, 6, 45, 58, 31, 92, 110, 36, 94, 18, 107, 18, 75, 47, 103, 
      64, 63, 112, 45, 58, 123, 5, 125, 24, 85, 75, 86, 46, 79, 104, 2, 
      11, 125, 83, 30, 52, 16, 34, 33, 42, 19, 45, 16, 113, 12, 119, 51, 
      6, 44, 94, 102, 70, 88, 114, 7, 39, 6, 25, 92, 92, 112, 75, 9, 
      118, 102, 37, 70, 126, 92, 107, 55, 60, 72, 34, 96, 64, 83, 39, 18, 
      61, 46, 101, 100, 86, 17, 3, 72, 39, 120, 126, 37, 103, 115, 76, 113, 
      121, 70, 93, 74, 3, 57, 83, 67, 48, 120, 106, 109, 48, 76, 112, 119, 
      86, 26, 84, 9, 52, 85, 120, 104, 62, 97, 53, 124, 126, 111, 50, 58, 
      32, 100, 113, 117, 71, 77, 19, 115, 58, 26, 115, 98, 113, 36, 86, 85, 
      16, 52, 35, 92, 36, 115, 106, 50, 64, 89, 107, 78, 74, 42, 58, 91, 
      113, 92, 2, 86, 56, 56, 15, 104, 42, 32, 44, 48, 70, 72, 51, 51, 
      66, 84, 122, 92, 51, 106, 17, 8, 11, 21, 42, 39, 1, 69, 12, 19, 
      81, 110, 125, 73, 128, 71, 66, 42, 55, 63, 9, 114, 8, 56, 106, 51, 
      79, 105, 113, 119, 24, 33, 115, 76, 64, 78, 105, 68, 26, 58, 55, 124, 
      79, 89, 92, 44, 66, 71, 20, 72, 89, 55, 107, 94, 46, 58, 49, 99, 
      94, 55, 89, 121, 100, 90, 14, 50, 76, 59, 6, 29, 107, 2, 111, 10, 
      86, 64, 28, 73, 16, 86, 77, 7, 7, 20, 3, 56, 107, 79, 67, 111, 
      13, 116, 14, 66, 18, 72, 1, 98, 109, 117, 126, 65, 35, 13, 65, 75, 
      98, 11, 85, 66, 22, 120, 76, 56, 121, 84, 58, 107, 68, 71, 87, 47, 
      31, 74, 111, 52, 14, 57, 38, 51, 107, 52, 50, 46, 18, 33, 11, 55, 
      33, 38, 54, 15, 63, 90, 31, 100, 9, 50, 0, 28, 0, 24, 18, 34, 
      22, 18, 77, 115, 120, 28, 62, 48, 67, 34, 9, 56, 22, 3, 122, 55, 
      123, 98, 1, 87, 90, 83, 71, 28, 99, 29, 47, 114, 110, 52, 41, 78, 
      117, 116, 76, 43, 109, 57, 116, 4, 68, 92, 23, 43, 24, 41, 52, 70, 
      6, 71, 35, 31, 31, 20, 122, 120, 105, 93, 23, 46, 24, 0, 41, 90, 
      80, 70, 56, 37, 64, 97, 98, 74, 96, 83, 16, 65, 44, 12, 19, 25, 
      86, 55, 89, 33, 1, 68, 36, 121, 116, 50, 3, 86, 107, 124, 7, 58, 
      75, 88, 92, 83, 93, 48, 74, 15, 7, 125, 36, 76, 123, 24, 25, 44, 
      119, 50, 35, 19, 51, 48, 17, 56, 12, 79, 1, 73, 101, 30, 57, 73, 
      8, 64, 82, 28, 107, 124, 108, 65, 36, 96, 30, 123, 79, 77, 22, 12, 
      33, 110, 117, 90, 93, 29, 74, 104, 52, 127, 12, 41, 65, 8, 93, 71, 
      68, 106, 110, 101, 41, 58, 96, 14, 14, 35, 67, 124, 91, 40, 37, 109, 
      117, 82, 33, 11, 107, 75, 121, 8, 75, 36, 106, 24, 57, 50, 106, 87, 
      27, 41, 17, 86, 73, 22, 19, 61, 116, 71, 4, 7, 103, 58, 49, 101, 
      47, 68, 91, 112, 42, 83, 125, 10, 75, 53, 40, 34, 97, 127, 24, 100, 
      25, 127, 103, 54, 93, 64, 104, 46, 9, 76, 117, 25, 55, 96, 5, 121, 
      98, 72, 24, 64, 66, 127, 109, 123, 87, 52, 120, 61, 30, 51, 90, 71, 
      97, 127, 123, 68, 123, 15, 7, 39, 74, 68, 115, 69, 55, 69, 91, 2, 
      103, 18, 61, 33, 47, 85, 22, 36, 25, 25, 42, 113, 60, 52, 23, 124, 
      52, 108, 79, 48, 112, 100, 60, 104, 115, 55, 43, 76, 115, 90, 48, 94, 
      122, 69, 69, 40, 9, 23, 12, 59, 1, 117, 82, 0, 4, 27, 58, 16, 
      1, 93, 45, 100, 56, 56, 6, 6, 12, 76, 31, 108, 110, 123, 63, 28, 
      29, 69, 98, 44, 59, 82, 117, 21, 92, 74, 55, 113, 50, 23, 81, 80, 
      42, 103, 128, 126, 16, 30, 3, 78, 14, 52, 113, 70, 47, 27, 56, 122, 
      16, 60, 110, 6, 89, 125, 36, 17, 88, 116, 78, 115, 25, 97, 44, 54, 
      20, 105, 80, 95, 103, 9, 122, 64, 97, 95, 106, 20, 59, 79, 119, 107, 
      115, 75, 75, 109, 4, 113, 52, 5, 96, 20, 18, 78, 33, 41, 51, 52, 
      49, 78, 21, 24, 12, 41, 99, 30, 95, 89, 105, 106, 38, 40, 67, 42, 
      106, 104, 71, 34, 87, 30, 58, 49, 69, 127, 97, 125, 30, 68, 7, 97, 
      77, 110, 126, 119, 52, 0, 69, 27, 28, 42, 12, 96, 96, 70, 43, 107, 
      71, 123, 114, 46, 70, 44, 80, 102, 95, 16, 105, 3, 53, 94, 100, 47, 
      95, 114, 31, 17, 29, 45, 37, 119, 7, 76, 21, 107, 21, 64, 128, 45, 
      6, 27, 51, 43, 29, 120, 87, 123, 56, 120, 1, 78, 103, 30, 119, 98, 
      106, 73, 101, 42, 29, 40, 75, 106, 37, 52, 110, 79, 127, 26, 106, 87
	};

  qint16 ImagData[2048] = {
      32, 61, 51, 77, 102, 13, 105, 108, 45, 55, 73, 90, 95, 97, 50, 55, 
      122, 73, 109, 35, 80, 75, 123, 11, 64, 67, 12, 116, 113, 56, 100, 19, 
      79, 33, 57, 108, 25, 39, 62, 43, 102, 126, 20, 30, 90, 48, 125, 124, 
      82, 110, 51, 81, 126, 72, 119, 92, 62, 82, 114, 25, 51, 127, 52, 84, 
      115, 127, 84, 14, 5, 79, 73, 123, 96, 85, 67, 33, 123, 69, 4, 89, 
      67, 8, 114, 42, 29, 15, 40, 29, 83, 8, 35, 36, 113, 57, 97, 77, 
      100, 15, 125, 109, 6, 60, 42, 81, 29, 74, 77, 77, 57, 5, 66, 52, 
      14, 59, 58, 71, 103, 90, 112, 7, 28, 59, 123, 101, 58, 43, 8, 95, 
      65, 26, 55, 22, 96, 47, 121, 2, 106, 80, 69, 83, 93, 12, 112, 2, 
      38, 23, 119, 9, 74, 82, 83, 111, 7, 105, 68, 89, 27, 70, 90, 122, 
      57, 11, 7, 81, 102, 88, 44, 121, 67, 122, 9, 27, 99, 117, 100, 38, 
      19, 109, 100, 35, 29, 41, 106, 105, 73, 73, 37, 89, 102, 57, 57, 60, 
      36, 86, 116, 116, 96, 33, 88, 17, 16, 24, 19, 75, 9, 105, 93, 119, 
      63, 84, 114, 69, 36, 125, 5, 42, 125, 47, 40, 15, 117, 17, 43, 115, 
      64, 79, 75, 89, 4, 68, 4, 106, 44, 108, 31, 74, 120, 6, 7, 3, 
      87, 77, 15, 102, 79, 9, 9, 17, 101, 12, 30, 31, 13, 110, 89, 94, 
      83, 66, 42, 85, 15, 19, 3, 123, 124, 16, 60, 84, 37, 97, 71, 55, 
      34, 96, 115, 93, 52, 120, 33, 68, 122, 34, 32, 119, 9, 38, 76, 26, 
      81, 102, 64, 83, 102, 30, 77, 14, 66, 107, 118, 64, 36, 84, 117, 65, 
      125, 25, 14, 38, 51, 54, 40, 89, 12, 51, 38, 39, 14, 76, 36, 20, 
      0, 36, 71, 111, 5, 116, 17, 107, 102, 117, 18, 65, 52, 22, 74, 78, 
      27, 67, 127, 63, 89, 53, 4, 37, 103, 44, 11, 65, 47, 95, 67, 103, 
      105, 24, 16, 105, 82, 2, 115, 66, 70, 78, 97, 109, 49, 11, 94, 42, 
      107, 48, 106, 23, 17, 113, 6, 88, 94, 56, 49, 125, 51, 56, 20, 42, 
      40, 114, 32, 40, 52, 91, 18, 112, 11, 59, 4, 96, 90, 27, 87, 71, 
      109, 71, 115, 54, 46, 63, 33, 119, 60, 33, 55, 90, 51, 23, 110, 75, 
      48, 28, 28, 67, 55, 95, 9, 108, 87, 17, 110, 26, 78, 70, 21, 1, 
      99, 98, 54, 7, 75, 22, 93, 68, 32, 117, 97, 114, 9, 23, 94, 89, 
      99, 64, 54, 78, 110, 86, 67, 38, 90, 49, 73, 114, 108, 115, 120, 104, 
      0, 0, 11, 33, 3, 54, 44, 69, 119, 38, 43, 110, 44, 18, 65, 110, 
      49, 89, 80, 58, 61, 122, 11, 36, 57, 75, 112, 60, 56, 96, 60, 110, 
      60, 64, 62, 29, 11, 9, 114, 30, 110, 91, 112, 120, 18, 50, 126, 83, 
      115, 62, 2, 80, 30, 68, 93, 78, 75, 55, 31, 55, 1, 78, 123, 12, 
      5, 113, 32, 1, 104, 18, 113, 12, 45, 76, 75, 85, 83, 55, 18, 96, 
      31, 83, 110, 11, 124, 4, 107, 107, 6, 70, 121, 41, 103, 77, 101, 102, 
      6, 36, 84, 63, 125, 96, 73, 38, 33, 113, 57, 104, 13, 110, 4, 115, 
      115, 67, 15, 23, 90, 106, 4, 97, 123, 44, 82, 44, 28, 101, 93, 36, 
      75, 54, 12, 3, 63, 36, 43, 37, 22, 51, 89, 26, 85, 57, 55, 22, 
      25, 79, 34, 72, 121, 91, 87, 123, 99, 78, 121, 8, 34, 126, 99, 61, 
      87, 53, 49, 27, 49, 4, 60, 43, 125, 71, 108, 52, 59, 106, 127, 67, 
      118, 95, 73, 124, 106, 123, 83, 49, 61, 117, 2, 20, 60, 70, 8, 84, 
      114, 14, 56, 36, 126, 78, 32, 17, 70, 106, 107, 107, 26, 70, 112, 15, 
      110, 115, 28, 10, 61, 107, 60, 53, 64, 16, 17, 111, 77, 34, 111, 7, 
      59, 92, 43, 51, 67, 114, 100, 9, 36, 49, 111, 54, 31, 76, 61, 115, 
      120, 105, 91, 95, 115, 8, 43, 1, 106, 65, 47, 29, 68, 37, 9, 11, 
      9, 52, 16, 57, 115, 45, 15, 73, 112, 45, 5, 18, 10, 95, 58, 86, 
      90, 73, 80, 112, 85, 112, 60, 18, 9, 91, 39, 86, 84, 68, 92, 65, 
      62, 64, 120, 50, 15, 31, 88, 107, 124, 28, 97, 75, 52, 65, 63, 83, 
      95, 39, 11, 106, 50, 99, 23, 14, 116, 112, 128, 111, 5, 70, 128, 65, 
      112, 9, 126, 118, 72, 55, 43, 92, 2, 48, 118, 70, 61, 64, 40, 122, 
      126, 66, 127, 58, 55, 27, 25, 107, 93, 68, 106, 66, 71, 27, 75, 18, 
      7, 87, 78, 28, 52, 81, 71, 16, 22, 0, 54, 63, 20, 85, 2, 15, 
      122, 125, 4, 63, 110, 31, 107, 104, 81, 0, 49, 116, 87, 48, 81, 31, 
      73, 126, 109, 36, 87, 46, 126, 11, 32, 104, 11, 68, 102, 95, 18, 56, 
      45, 61, 75, 19, 116, 82, 21, 72, 119, 100, 88, 60, 33, 73, 32, 41, 
      117, 113, 102, 119, 23, 66, 80, 117, 85, 50, 95, 105, 77, 11, 118, 7, 
      67, 15, 49, 104, 31, 113, 91, 48, 32, 32, 98, 6, 88, 79, 96, 125, 
      49, 33, 112, 103, 59, 12, 72, 24, 68, 45, 40, 93, 66, 101, 26, 87, 
      7, 103, 87, 121, 12, 116, 65, 79, 40, 10, 109, 18, 47, 80, 128, 66, 
      127, 29, 51, 89, 8, 96, 54, 104, 49, 41, 126, 92, 53, 13, 94, 82, 
      9, 15, 126, 64, 3, 7, 18, 114, 60, 72, 63, 9, 115, 37, 34, 76, 
      61, 47, 84, 120, 79, 36, 26, 56, 3, 112, 78, 26, 67, 7, 110, 57, 
      70, 73, 87, 48, 10, 58, 6, 94, 5, 122, 95, 120, 66, 31, 33, 97, 
      127, 46, 96, 14, 76, 55, 94, 33, 12, 58, 82, 17, 58, 83, 106, 39, 
      52, 113, 90, 31, 97, 37, 36, 1, 48, 56, 39, 37, 31, 120, 110, 51, 
      61, 72, 63, 35, 127, 24, 110, 4, 42, 96, 82, 22, 122, 70, 32, 74, 
      117, 115, 62, 57, 40, 7, 96, 17, 46, 51, 113, 3, 108, 37, 32, 63, 
      93, 26, 28, 125, 76, 39, 124, 115, 24, 0, 91, 111, 15, 5, 77, 77, 
      66, 1, 88, 121, 112, 14, 45, 31, 72, 78, 39, 102, 102, 100, 45, 7, 
      91, 127, 21, 15, 117, 62, 109, 104, 24, 32, 7, 78, 99, 65, 4, 127, 
      64, 42, 22, 80, 74, 96, 20, 46, 18, 109, 43, 35, 1, 103, 64, 69, 
      111, 93, 86, 23, 70, 123, 76, 103, 126, 113, 27, 4, 58, 2, 61, 122, 
      32, 49, 55, 106, 106, 58, 49, 119, 95, 94, 121, 65, 101, 58, 109, 50, 
      95, 125, 67, 55, 27, 41, 14, 48, 42, 44, 105, 68, 67, 99, 15, 80, 
      44, 43, 74, 111, 25, 86, 115, 25, 38, 64, 114, 64, 35, 68, 74, 53, 
      2, 90, 65, 49, 8, 46, 30, 26, 104, 50, 7, 48, 99, 21, 117, 41, 
      42, 26, 98, 9, 122, 20, 37, 88, 18, 66, 92, 119, 94, 96, 52, 31, 
      67, 28, 108, 85, 104, 102, 60, 40, 88, 126, 99, 106, 90, 76, 96, 64, 
      111, 9, 124, 13, 70, 52, 14, 93, 79, 100, 73, 104, 74, 121, 112, 65, 
      101, 61, 106, 41, 125, 36, 9, 96, 106, 118, 42, 103, 69, 59, 105, 122, 
      10, 91, 30, 51, 34, 107, 127, 83, 90, 119, 88, 73, 49, 81, 46, 52, 
      47, 60, 64, 117, 26, 43, 73, 62, 34, 74, 112, 8, 56, 11, 72, 69, 
      98, 30, 75, 59, 110, 85, 45, 44, 32, 122, 38, 20, 46, 95, 90, 90, 
      1, 48, 115, 41, 76, 38, 16, 50, 105, 126, 110, 11, 43, 30, 41, 126, 
      70, 96, 108, 21, 116, 13, 95, 93, 92, 17, 57, 65, 68, 110, 87, 103, 
      68, 122, 9, 69, 36, 62, 88, 27, 78, 42, 113, 17, 13, 123, 20, 20, 
      20, 11, 58, 86, 106, 101, 91, 60, 91, 123, 65, 39, 101, 30, 30, 59, 
      79, 79, 16, 16, 36, 94, 53, 106, 120, 51, 7, 73, 96, 41, 63, 28, 
      120, 62, 69, 28, 12, 8, 105, 99, 25, 115, 88, 84, 127, 4, 54, 63, 
      75, 11, 84, 7, 71, 91, 62, 79, 27, 83, 49, 13, 48, 34, 31, 80, 
      67, 53, 28, 110, 110, 36, 79, 100, 122, 118, 49, 21, 102, 15, 20, 46, 
      109, 75, 75, 119, 74, 1, 104, 78, 61, 34, 33, 62, 29, 6, 22, 33, 
      25, 78, 105, 104, 103, 91, 110, 100, 26, 127, 12, 83, 28, 31, 43, 25, 
      65, 122, 51, 75, 78, 91, 51, 110, 118, 96, 37, 102, 18, 65, 78, 90, 
      49, 93, 114, 7, 18, 110, 54, 53, 123, 96, 126, 30, 12, 49, 64, 73, 
      125, 63, 51, 127, 33, 85, 123, 86, 38, 68, 0, 113, 52, 39, 122, 59, 
      37, 11, 75, 20, 9, 74, 37, 46, 93, 110, 45, 123, 122, 26, 98, 79, 
      118, 77, 90, 95, 49, 32, 5, 60, 83, 36, 66, 31, 38, 83, 114, 110, 
      27, 51, 114, 33, 124, 79, 21, 106, 84, 70, 32, 5, 30, 46, 81, 126, 
      27, 97, 113, 60, 20, 104, 61, 15, 112, 81, 12, 116, 4, 5, 127, 88, 
      48, 65, 98, 6, 93, 90, 59, 75, 43, 22, 51, 118, 29, 46, 42, 11, 
      66, 107, 116, 93, 49, 38, 89, 113, 118, 10, 62, 16, 32, 113, 25, 16, 
      70, 40, 49, 101, 107, 87, 53, 82, 27, 79, 86, 77, 44, 47, 22, 102, 
      63, 45, 99, 30, 108, 105, 108, 47, 49, 110, 59, 73, 89, 123, 70, 81, 
      73, 119, 111, 22, 23, 31, 96, 25, 126, 91, 22, 110, 116, 123, 73, 72, 
      23, 66, 70, 21, 63, 68, 25, 80, 3, 41, 68, 42, 77, 46, 17, 117, 
      82, 84, 86, 95, 108, 66, 19, 49, 105, 22, 42, 124, 103, 28, 128, 8, 
      54, 52, 51, 14, 54, 79, 126, 28, 45, 34, 37, 24, 3, 58, 31, 111, 
      68, 117, 125, 75, 15, 119, 76, 113, 54, 78, 9, 118, 82, 13, 90, 51, 
      11, 27, 32, 29, 90, 97, 70, 71, 81, 126, 81, 77, 116, 73, 43, 123, 
      56, 77, 92, 87, 27, 10, 35, 111, 72, 59, 55, 99, 84, 84, 21, 55, 
      65, 48, 61, 44, 99, 49, 91, 62, 93, 120, 66, 116, 28, 112, 11, 60, 
      3, 103, 23, 21, 23, 89, 27, 38, 98, 64, 116, 7, 56, 73, 72, 105, 
      16, 38, 0, 122, 98, 96, 18, 45, 19, 64, 104, 81, 88, 82, 93, 110, 
      80, 23, 73, 21, 116, 10, 43, 74, 61, 103, 68, 29, 91, 19, 84, 81, 
      29, 23, 21, 19, 26, 122, 2, 123, 3, 124, 38, 67, 110, 115, 24, 85, 
      120, 125, 14, 23, 96, 6, 9, 63, 109, 128, 1, 69, 110, 116, 108, 112, 
      96, 15, 65, 22, 106, 119, 22, 113, 50, 49, 35, 111, 95, 57, 91, 121, 
      22, 31, 82, 104, 109, 51, 15, 10, 46, 106, 27, 101, 84, 3, 101, 118, 
      63, 107, 17, 97, 118, 107, 33, 27, 67, 51, 61, 127, 77, 121, 63, 56, 
      99, 95, 57, 7, 11, 102, 84, 4, 71, 92, 14, 28, 104, 18, 113, 118, 
      2, 48, 21, 69, 13, 5, 119, 124, 46, 82, 9, 27, 5, 60, 19, 127, 
      55, 122, 93, 74, 69, 90, 1, 100, 119, 1, 106, 98, 128, 29, 118, 82, 
      13, 34, 98, 103, 13, 60, 28, 118, 41, 110, 33, 112, 24, 97, 4, 82, 
      73, 48, 27, 101, 19, 63, 2, 24, 62, 107, 18, 94, 88, 4, 63, 124, 
      14, 95, 82, 76, 64, 73, 55, 10, 37, 72, 81, 119, 125, 12, 85, 77, 
      61, 46, 61, 86, 123, 11, 102, 76, 117, 13, 38, 7, 65, 98, 36, 29, 
      42, 58, 94, 65, 49, 116, 124, 80, 17, 79, 49, 127, 37, 90, 69, 25 
	};
  

  int i;
  for (i = 0; i<1000; i++)
    FFT(RealData, ImagData, 2048, 11, -1);

}

